package com.ssh.service.impl;

import java.util.List;

import com.ssh.dao.IPeopleDAO;
import com.ssh.people.People;
import com.ssh.service.IPeopleService;

public class PeopleService implements IPeopleService{

	private IPeopleDAO peopleDAO;
	
	public People getPeopleById(String id) {
		return peopleDAO.findById(id);
	}

	public People getPeopleByUsername(String username) {
		List list = peopleDAO.findByUsername(username);
		if(list.size() == 0){
			return null;
		}else{
			return (People)list.get(0);
		}
	}

	public void addPeople(People people) {
		peopleDAO.save(people);
	}

	public IPeopleDAO getPeopleDAO() {
		return peopleDAO;
	}

	public void setPeopleDAO(IPeopleDAO peopleDAO) {
		this.peopleDAO = peopleDAO;
	}
}
